#include<stdio.h>
int main()
{
	int n;
	scanf("%d",&n);
	if(0==n%2)
	{
		printf("%d",n/2);
	}
	else
	{
		printf("%d",n*3+1);
	}
	return 0;
}
